import java.util.Base64;

public class Base64Example {
    public static void main(String[] args) {
        //对字符串进行base64加码
        String originalStr = "我叫王鑫博!";
        String base64Str = Base64.getEncoder().encodeToString(originalStr.getBytes());
        System.out.println("Original String: " + originalStr);
        System.out.println("Base64 Encoded String: " + base64Str+"555");
        //对字符串进行base64解码
        byte[] decode = Base64.getDecoder().decode(base64Str);
        String s = new String(decode);
        System.out.println("--------------------------------");
        System.out.println(s);
        System.out.println("--------------------------------");

    }
}
